IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntitySpan Class > EntitySpan Constructor : EntitySpan Constructor(EntityRelationLink[]) |
'Declaration
Public Function New( _ ByVal ParamArray entityRelationLinks() As EntityRelationLink _ )
'Usage
Dim entityRelationLinks() As EntityRelationLink Dim instance As New EntitySpan(entityRelationLinks)
public EntitySpan( params EntityRelationLink[] entityRelationLinks )
Exception | Description |
---|---|
System.ArgumentException | Thrown if the relationships do not connect |
The EntitySpan is used in retrieving an entity graph with EntityManager.FindEntityGraph
public void FindEntityGraph() { DomainModelEntityManager mgr = new DomainModelEntityManager(); // Preload some data into cache for this example. var emp = mgr.Employees.Where(e => e.Id == 1).Include("OrderSummaries.OrderDetails.Product").ToList().First(); // Get an order for this example. OrderSummary anOrder = mgr.FindEntities<OrderSummary>(EntityState.Unchanged).First(); // Now retrieve an object graph for the selected order. var roots = new List<Entity> { anOrder }; // Add spans - we want a) employee for the order, and b) order details and their products. // This requires 2 spans. EntitySpan span1 = new EntitySpan(EntityRelations.FK_OrderSummary_Employee.ToRole1Link); EntitySpan span2 = new EntitySpan(EntityRelations.FK_Order_Details_Orders.ToRole2Link, EntityRelations.FK_Order_Details_Products.ToRole1Link); var spans = new List<EntitySpan> { span1, span2 }; // Get entity graph. var entityGraph = mgr.FindEntityGraph(roots, spans, EntityState.Unchanged); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2